home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1995 November / EnigmA AMIGA RUN 02 (1995)(G.R. Edizioni)(IT)[!][issue 1995-11][Skylink CD].iso / earcd / util / text / frexxedv.lha / FrexxEdpatch / install_patch < prev    next >
Text File  |  1995-09-28  |  4KB  |  136 lines

  1. (set previnstall (getassign "FrexxEd" "a"))
  2.  
  3. (if previnstall
  4.   (working)
  5.   (abort "We need a previously installed FrexxEd and a FrexxEd: assign!")
  6. )
  7.  
  8. (set txt_alreadyinstalled "%s is already installed!")
  9.  
  10. (set txt_askbackup "Backup FPL-programs that are replaced with new ones?")
  11.  
  12. (set txt_askbackuphelp (cat "Installer is about to copy a lot of FPL-programs "
  13.     "to the FrexxEd:FPL/ directory. If you have done some changes to any "
  14.     "of the programs in the distribution, and would like to keep those "
  15.     "changes, press 'yes' now, and all FPL programs that are replaced with "
  16.     "a different one will be copied into FrexxEd:oldFPL/.  NOTE: This "
  17.     "doesn't include User.FPL. User.FPL is meant to get changed and won't "
  18.     "be updated by installer!"))
  19.  
  20. (set txt_backupfilestext (cat "The following files were copied to "
  21.                               "this directory when FrexxEd "
  22.                               "was updated:\n"))
  23.  
  24. (set Origin
  25.    (askfile
  26.       (prompt
  27.        "Enter the complete name and path of your FrexxEd 1.9"
  28.        " library file!")
  29.       (default "FrexxEd:libs/frexxed.library")
  30.       (help
  31.        "To be able to perform this patch, we must know which "
  32.        "frexxed.library to update! Enter the complete path and file name "
  33.        "and press OK!")
  34.    )
  35. )
  36. (set Destination
  37.    (askfile
  38.       (prompt
  39.        "Enter the complete name and path of your to become FrexxEd 1.10"
  40.        " library!")
  41.       (default "FrexxEd:libs/frexxed.library")
  42.       (help
  43.        "To be able to perform this patch, we must know where "
  44.        "to put the updated version! Enter the complete path and file name "
  45.        "and press OK!")
  46.    )
  47. )
  48.  
  49. (set @default-dest Destination)
  50.  
  51. (if (= 2 @user-level)
  52.    ; Only experts have the advantage of changing LIBS:!
  53.    (set libdir
  54.       (askdir
  55.          (prompt "Enter drawer/partition to install fpl.library in!")
  56.          (help @askdir-help)
  57.          (default "LIBS:")
  58.       )
  59.    )
  60.    (set libdir "LIBS:")
  61. )
  62.  
  63. (working)
  64. (run ("spatch -pfred19.pch \"-o%s\" \"%s\"" Destination Origin))
  65.  
  66. ; Copy fpl.library to LIBS:
  67. (copylib
  68.    (prompt "Install fpl.library?")
  69.    (help @copylib-help)
  70.    (source "libs/fpl.library")
  71.    (dest libdir)
  72.    (confirm)
  73. )
  74.  
  75. ; Make a backup-directory and copy all modified files (to preserve
  76. ; changes done by the user!) to that!
  77.  
  78. (set frexxdest previnstall)
  79. (set backupdir (tackon frexxdest "oldFPL"))
  80. (makedir backupdir)
  81. (set destdir (tackon frexxdest "FPL/"))
  82. (set origdir "FPL/")
  83. (set backupchanged (askbool
  84.                       (prompt txt_askbackup)
  85.                       (help txt_askbackuphelp)
  86.                    )
  87. )
  88. (foreach origdir "~(User.FPL)"
  89.   (if (< @each-type 0)
  90.      ; only do this stuff with FILES. Not DIRECTORIES.
  91.      (
  92.        (set destfile (tackon destdir @each-name))
  93.        (set origfile (tackon "FPL" @each-name))
  94.        (if (and backupchanged (exists destfile))
  95.            ; Backuping is wanted and
  96.            ; they both exist. Let's check if they're identical!
  97.            (if (= (getsum destfile) (getsum origfile))
  98.                ; Identical! Tell 'em it's already here!
  99.                (working (txt_alreadyinstalled @each-name))
  100.                ; Different, backup the previous file and copy the
  101.                ; new one
  102.                (
  103.                   (copyfiles
  104.                      (source destfile)
  105.                      (dest backupdir)
  106.                      (infos)
  107.                   )
  108.                   (copyfiles
  109.                      (source origfile)
  110.                      (dest destdir)
  111.                      (infos)
  112.                   )
  113.                   (set allfiles (cat allfiles origfile "\n"))
  114.                )
  115.            )
  116.            ; This is obviously a new file, it was not previously
  117.            ; present! Just copy it.
  118.            (copyfiles
  119.               (source origfile)
  120.               (dest destdir)
  121.               (infos)
  122.            )
  123.        )
  124.      )
  125.    )
  126. )
  127. (if allfiles
  128.    ; There has been some files backuped!
  129.    (textfile
  130.       (dest (tackon backupdir "README"))
  131.       (append (cat txt_backupfilestext allfiles))
  132.    )
  133. )   
  134.  
  135. (message "done!")
  136.